revision:
The property returns a node object and is read-only.
Syntax:
element.previousSibling or node.previousSibling: returns the previous sibling of the node; "null" if no previous sibling exists.
property value:
none :
example
The HTML content of the previous sibling of the second list item is:
Note: Whitespace between elements is considered text nodes. If you add whitespace between the two li elements, the result will be "undefined".
<div>
<ul><li id="item1">Coffee (first item)</li><li id="item2">Tea (second item)</li></ul>
<p>The HTML content of the previous sibling of the second list item is: <span id="prop"></span></p>
<p style="font-size: 0.9vw;"><strong>Note:</strong> Whitespace between elements is
considered text nodes. If you add whitespace between the two li elements, the result will be "undefined".</p>
</div>
<script>
let text = document.getElementById("item2").previousSibling.innerHTML;
document.getElementById("prop").innerHTML = text;
</script>